import { App } from "vue";
export default function globalComponents(app: App) {
  const components = import.meta.glob("./**/**.{vue,tsx}", { eager: true }); //获取文件夹及其嵌套的多级子文件夹

  for (let [key, value] of Object.entries(components)) {
    const name = key.replace("./", "").split("/")[0];
    app.component(value.default.name || name, value.default);
  }
}